package xy.donate.android.ui.activity;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.hjq.base.BaseFragmentAdapter;

import java.util.List;

import xy.donate.android.R;
import xy.donate.android.common.MyActivity;
import xy.donate.android.common.MyFragment;
import xy.donate.android.ui.fragment.OrderFragment;

public class OrderListActivity extends MyActivity {

    private TabLayout tabLayout;
    private ViewPager recyclerView;
    private BaseFragmentAdapter<MyFragment<OrderListActivity>> mAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.avtivity_order_list;
    }

    @Override
    protected void initView() {
        tabLayout = findViewById(R.id.tl_tab);
        recyclerView = findViewById(R.id.view_pager);
        mAdapter = new BaseFragmentAdapter<>(this);
        mAdapter.addFragment(OrderFragment.getInstance(0),"全部订单");
        mAdapter.addFragment(OrderFragment.getInstance(1),"待完成");
        mAdapter.addFragment(OrderFragment.getInstance(2),"待取货");
        mAdapter.addFragment(OrderFragment.getInstance(3),"已完成");
        mAdapter.setLazyMode(true);
        recyclerView.setAdapter(mAdapter);
        tabLayout.setupWithViewPager(recyclerView);
        recyclerView.setCurrentItem(getIntent().getIntExtra("index",0),false);
    }

    @Override
    protected void initData() {

    }
}